home *** CD-ROM | disk | FTP | other *** search
/ Games of Daze / Infomagic - Games of Daze (Summer 1995) (Disc 1 of 2).iso / djgpp / contrib / pdcurs22 / src / portable / move.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-26  |  3.2 KB  |  108 lines

  1. /*
  2. ***************************************************************************
  3. * This file comprises part of PDCurses. PDCurses is Public Domain software.
  4. * You may use this code for whatever purposes you desire. This software
  5. * is provided AS IS with NO WARRANTY whatsoever.
  6. * Should this software be used in another application, an acknowledgement
  7. * that PDCurses code is used would be appreciated, but is not mandatory.
  8. *
  9. * Any changes which you make to this software which may improve or enhance
  10. * it, should be forwarded to the current maintainer for the benefit of 
  11. * other users.
  12. *
  13. * The only restriction placed on this code is that no distribution of
  14. * modified PDCurses code be made under the PDCurses name, by anyone
  15. * other than the current maintainer.
  16. * See the file maintain.er for details of the current maintainer.
  17. ***************************************************************************
  18. */
  19. #define    CURSES_LIBRARY    1
  20. #include <curses.h>
  21.  
  22. /* undefine any macros for functions defined in this module */
  23. #undef    move
  24. #undef    wmove
  25.  
  26. /* undefine any macros for functions called by this module if in debug mode */
  27. #ifdef PDCDEBUG
  28. #endif
  29.  
  30. #ifdef PDCDEBUG
  31. char *rcsid_move  = "$Id$";
  32. #endif
  33.  
  34. /*man-start*********************************************************************
  35.  
  36.   Name:                                                          move
  37.  
  38.   Synopsis:
  39.       int move(int y, int x);
  40.       int wmove(WINDOW *win, int y, int x);
  41.  
  42.   X/Open Description:
  43.      The cursor associated with the window is moved to the given
  44.      location.  This does not move the physical cursor of the
  45.      terminal until refresh() is called.  The position specified is
  46.      relative to the upper left corner of the window, which is (0,0).
  47.  
  48.      NOTE: move() is a macro.
  49.  
  50.   X/Open Return Value:
  51.      All functions return OK on success and ERR on error.
  52.  
  53.   X/Open Errors:
  54.      No errors are defined for this function.
  55.  
  56.   Portability                             X/Open    BSD    SYS V
  57.                                           Dec '88
  58.       move                                  Y        Y       Y
  59.       wmove                                 Y        Y       Y
  60.  
  61. **man-end**********************************************************************/
  62.  
  63. /***********************************************************************/
  64. int    move(int y, int x)
  65. /***********************************************************************/
  66. {
  67. #ifdef PDCDEBUG
  68.     if (trace_on) PDC_debug("move() - called: y=%d x=%d\n",y,x);
  69. #endif
  70.  
  71.     if (stdscr == (WINDOW *)NULL)
  72.         return( ERR );
  73.  
  74.     if ((x < 0) ||
  75.         (y < 0) ||
  76.         (x >= stdscr->_maxx) ||
  77.         (y >= stdscr->_maxy))
  78.     {
  79.         return( ERR );
  80.     }
  81.     stdscr->_curx = x;
  82.     stdscr->_cury = y;
  83.     return( OK );
  84. }
  85. /***********************************************************************/
  86. int    wmove(WINDOW *win, int y, int x)
  87. /***********************************************************************/
  88. {
  89. #ifdef PDCDEBUG
  90.     if (trace_on) PDC_debug("wmove() - called: y=%d x=%d\n",y,x);
  91. #endif
  92.  
  93.     if (win == (WINDOW *)NULL)
  94.         return( ERR );
  95.  
  96.     if ((x < 0) ||
  97.         (y < 0) ||
  98.         (x >= win->_maxx) ||
  99.         (y >= win->_maxy))
  100.     {
  101.         return( ERR );
  102.     }
  103.     win->_curx = x;
  104.     win->_cury = y;
  105.     return( OK );
  106. }
  107.